﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NHibernate.Proxy;

namespace ScheduleMaker.DB.Domain
{
    public class Schedule
    {
        private Classroom classroom;
        private Teacher teacher;
        private Day day;
        private ClassHour classHour;
        private Subject subject;
        private Group group;

        public virtual Classroom Classroom
        {
            get { return classroom; }
            set { classroom = value; }
        }

        public virtual Teacher Teacher
        {
            get { return teacher; }
            set { teacher = value; }
        }

        public virtual Day Day
        {
            get { return day; }
            set { day = value; }
        }

        public virtual ClassHour ClassHour
        {
            get { return classHour; }
            set { classHour = value; }
        }

        public virtual Subject Subject
        {
            get { return subject; }
            set { subject = value; }
        }

        public virtual Group Group
        {
            get { return group; }
            set { group = value; }
        }

        
        public override bool Equals(object obj)
        {
            if (obj == null)
                return false;
            var t = obj as Schedule;
            if (t == null)
                return false;
            if (Classroom == t.Classroom 
                && Teacher == t.Teacher
                && Day == t.Day
                && ClassHour == t.ClassHour
                && Subject == t.Subject
                && Group == t.Group)
                return true;
            return false;
        }

        public override int GetHashCode()
        {
            string objects = (Classroom.GetHashCode() + "|" 
                + Teacher.GetHashCode() + "|" 
                + Day.GetHashCode() + "|"
                + ClassHour.GetHashCode() + "|"
                + Subject.GetHashCode() + "|" 
                + Group.GetHashCode());
            return objects.GetHashCode();
        }

    }
}
